package cn.shen.sheng.da.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedMethods("*")
                .allowedHeaders("*")

                .allowCredentials(true)
                .allowedOrigins("*","http://192.168.5.189/*","http://192.168.5.195/*","http://192.168.5.185/*");

    }

   /* ResponseCookie cookie = ResponseCookie.from("tk", result.getJSONObject("properties").getString("accessToken")) // key & value
            .httpOnly(true)		// 禁止js读取
            .path("/")			// path
            .maxAge(3600 * 24 * 30)	// 1个小时候过期
            .sameSite("None")
            .secure(true)
            .build()
            ;
}*/
}